<template>
    <div>
        <a-modal
            v-model:visible="visible"
            :title="currentData.fsxmc"
            width="100%"
            wrapClassName="full-businessManagement-modal"
            :maskClosable="false"
            :destroyOnClose="true"
            :forceRender="true"
        >
            <a-spin size="large" :spinning="spinning" :key="spinningKey">
                <div class="businessManagement-content-box">
                    <div class="top-handle-v">
                        <div style="font-weight: 600;font-family: KaiTi !important;color: #38f;display: flex;align-items: center;">
                            <!-- {{ currentData.fhjmc }} -->
                            <div>
                                <span style="display: inline-block;border:2px solid #ff9200;padding: 0 5px;border-radius: 17.3px;color: #ff9200;margin-right: 10px;font-size: 18px;">{{ currentData.fhjmc }}</span>
                                <span>{{ currentData.fqymc }}</span>
                            </div>
                            <span v-if="currentData.fslbh" style="display: inline-block;border:2px solid #4eef66;padding: 0 5px;border-radius: 17.3px;color: #4eef66;margin-left: 10px;font-size: 14px;">{{ currentData.fslbh }}</span>
                        </div>
                        <div style="display: flex;align-items: center;">
                            <!-- <div style="display: flex;align-items: center;">
                                <a-button style="margin-left: 10px;" class="blue-btn" type="primary" @click="linkHandling()" icon="edit">提交</a-button>
                            </div> -->
                            <div style="display: flex;align-items: center;margin-left: 50px;">
                                <a-button class="blue-btn" type="primary" @click="refreshClick()" icon="reload">刷新</a-button>
                                <!-- <a-button style="margin-left: 10px;" @click="returnClick()" icon="close"></a-button> -->
                            </div>
                        </div>
                        
                    </div>
                    <div style="height: 10px;"></div>
                    <div>
                        <revisionRectification v-if="currentData.handlingMatterstype == '整改材料'" ref="revisionRectificationRef" :key="materialRectificationKey"/>
                        <withdrawalDocuments :currentObj="currentData" v-if="currentData.handlingMatterstype == '撤件'" ref="withdrawalDocumentsRef" :key="materialRectificationKey" @successChange="successChange"/>
                    </div>
                </div>
            </a-spin>
        </a-modal>
    </div>
</template>
<script>
import {
    spcyGetJobConcernByJobId,
} from './service/index'
import revisionRectification from '../allHandlingPage/manufacturing/materialReview/revisionRectification.vue'
import moment from 'moment'
import withdrawalDocuments from './withdrawalDocuments.vue'
export default {
    components:{
        revisionRectification,
        withdrawalDocuments,
    },
    props:{

    },
    data(){
        return{
            visible:false,
            currentData:{},
            spinning:false,
            spinningKey:null,
            materialReviewExaminationKey:null,
            materialRectificationKey:null,
            businessManagementmaterialRectificationKey:null,
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        getData(row){
            this.currentData = {}
            this.spinningStart()
            spcyGetJobConcernByJobId({jobid:row.jobid}).then(res=>{
                if(res.code == 200){
                    let data = {...row,...res.result}
                    let sqsx = data.sqsx
                    this.currentData = {
                        ...row,
                        fywflcode:'001002',
                        ...this.linkDetails,
                        jobid:data.job.id,
                        fblzt:data.job.fblzt,
                        fthyj:data.job.fthyj,
                        ...sqsx,
                        sqsxid:sqsx.id,
                        fslzt:String(sqsx.fslzt),
                        fsqsj:sqsx.fsqsj?moment(sqsx.fsqsj).format('YYYY-MM-DD'):'',
                        fslsj:sqsx.fslsj?moment(sqsx.fslsj).format('YYYY-MM-DD'):'',
                        isOwn:true,
                        dbrid:[],
                        opinion:'',//办理意见
                        smgflag:false,//是否发送短信
                        ...data.qy,
                        fqymc:sqsx.fqymc,
                    }
                    this.$nextTick(()=>{
                        this.visible = true
                        this.spinningKey = Date.now()
                        
                        setTimeout(()=>{
                            if(row.handlingMatterstype == '撤件'){
                                this.$refs.withdrawalDocumentsRef.getData(this.currentData)
                            }else{
                                if(this.$refs.revisionRectificationRef){
                                    this.$refs.revisionRectificationRef.getData({
                                        sqsxid:this.currentData.sqsxid,
                                        isTopTabs:true,
                                        isActiveKey:'材料审查',
                                        reserveBottom:-22,
                                        heightNum:128,
                                        isRefresh:false,
                                        fhjmc:this.currentData.fhjmc
                                    })
                                }
                            }
                            
                            this.spinningEnd()
                        },200)

                    })
                }else{
                    this.$message.warning(res.message)
                    this.currentData = row
                }
            })
            
        },
        successChange(val){
            this.$emit('successChange')
            this.visible = val
        },
        spinningStart(){
            this.spinning = true
        },
        spinningEnd(){
            this.spinning = false
        },
        refreshClick(){
            this.getData(this.currentData)
        },
        // linkHandling(){//提交
        //     let that = this
        //     this.$confirm({
        //         title:'确认要提交吗？',
        //         // icon: createVNode(ExclamationCircleOutlined),
        //         onOk() {
        //             spcyzwfwsubmitFlowByQy({sqsxid:that.currentData.sqsxid,jobid:that.currentData.jobid,}).then(res=>{
        //                 if(res.code == 200){
        //                     that.visible = false
        //                     that.$emit('successReturn')
        //                 }else{
        //                     that.$message.warning(res.message)
        //                 }
        //             })
        //         }
        //     })
        // },
    }
}
</script>
<style lang="less">
.full-businessManagement-modal{
    .ant-modal {
    max-width: 100%;
    top: 0;
    padding-bottom: 0;
    margin: 0;
  }
  .ant-modal-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh);
    // background: #fff;
  }
  .ant-modal-body {
    flex: 1;
    background: #f4f7fc !important;
    padding: 0px;
    height: calc(100vh - 50px);
  }
  .ant-modal-footer{
    display: none;
  }
  .businessManagement-content-box{

  }
}
</style>